/*访问后台的代码*/
layui.define([], function(exports) {
    var api={
            updateResContentMain:function(form,callback){
                Lib.submitForm("/content/resContentMain/update.json",form,{},callback)
            },
            saveForm:function(isNew,form,callback){

                var contentDesc = $("#contentDesc").val();
                if(contentDesc==null||contentDesc==""){
                    layer.tips('请填写详情介绍', '#wxin-contentDesc');
                    return;
                }

                var mainImg = $("#coverView").attr("src");
                if(mainImg==null||mainImg==""){
                    layer.tips('请上传图片', '#cover');
                    return;
                }

                var postUrl = "/content/resContentMain/update.json";
                if (isNew) {
                    postUrl = "/content/resContentMain/add.json";
                }
                Lib.submitFileForm(postUrl,form,{},callback)
            },
            del:function(ids,callback){
                Common.post("/content/resContentMain/delete.json",{"ids":ids},function(){
                    callback();
                })
            },
            status:function(id,contentStatus) {
                Common.post("/content/resContentMain/status.json",{"id":id,"contentStatus":contentStatus},function(){
                    Common.success("操作成功。");
                    window.dataReload();
                });
            }
		
    };
    exports('resContentMainApi',api);
});